package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

func convertToBin(n int) (result string) {
	for ; n > 0; n /= 2 {
		lsb := n % 2
		result = strconv.Itoa(lsb) + result
	}
	return result
}

func readFile() {
	const filename = "abc.txt"
	file, err := os.Open(filename)
	if err != nil {
		fmt.Println(err)
	}
	scanner := bufio.NewScanner(file)
	for scanner.Scan() {
		fmt.Println(scanner.Text())
	}
}
func sum(nums ...int) int {
	res := 0
	for i := range nums {
		res += nums[i]
	}
	return res
}
func main() {
	fmt.Println(
		convertToBin(111))
	readFile()
	fmt.Println(sum(12, 22, 3, 4, 5, 1232, 34, 31, 23))
}
